import { createStore, createLogger } from 'vuex'
import createPersistedState from 'vuex-persistedstate'
import actions from './modules/actions'
import getters from './modules/getters'
import mutations from './modules/mutations'
import state from './modules/state'
const debug = process.env.NODE_ENV !== 'production'
export default createStore({
  state,
  getters,
  mutations,
  actions,
  // 在生产环境中可以监听state的修改是否在mutations中
  strict: debug,
  plugin: [debug ? [createLogger()] : []],
  plugins: [
    createPersistedState({
      key: 'music-app'
    })
  ]
})
